/**
 * \file driver.h
 * \author Davide Gessa
 * \date 10-12-09
 */

#ifndef DRIVER_H
#define DRIVER_H

#include <types.h>

#define DRV_NF_ER	-1
#define DRV_OK		0

/**
 * Struttura di un driver generico
 */
typedef struct driver_p
{
	char name[32];								///< Nome del driver
	
	void (*open)();								///< Apre il device
	void (*close)();							///< Chiude il device
	void (*write)(char *, size_t, uint64_t);	///< Scrive sul device
	void (*read)(char *, size_t, uint64_t);		///< Legge dal devicce
	void (*seek)();								///< Imposta la posizione
	
	struct driver_p *next;						///< Puntatore al driver successivo
} driver_t;


driver_t *driver_list;

void driver_init();
uint32_t driver_add(driver_t *);
uint32_t driver_del(char *);
char *driver_get_x(uint32_t);
driver_t *driver_get(char *);

#endif
